package com.lu.reggie.common;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 将局部线程变量的值设置为session中的ID
     * @param id
     */
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    /**
     * 提供获取ID的get方法
     * @return
     */
    public static Long getCurrentId() {
        return threadLocal.get();
    }
}
